package com.hubu.file;
public class Counter {
    private int count = 0;
    public int getAndIncrement() {
        return getAndAdd(1);
    }
    public int getAndAdd(int value) {
        if (value <= 0) {
            throw new RuntimeException("添加的数必须大于0");
        }
        int result = this.count;
        count += value;
        return result;
    }
}
